<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<html>
<head>
<meta charset="UTF-8">
<title>我的账户-账户验证|绑定手机</title>
<jsp:include page="/include/wchat/head.jsp"></jsp:include>

<link type="text/css" rel="stylesheet" href="/v2/wchat/resrc/css/account.css">
</head>
<body>
<div id="header"> <a href="/wchatSecurityCenter.do" class="backto">返回</a>
  <div class="title-sub">验证账户信息</div>
</div>
<div id="wrap">
  <div class="phoneBind">
    <div class="link-touch">
      <ul class="items">
        <li>
          <label class="txt">手机</label>
          <input type="text" id="mobileNum" name="mobileNum" class="input" maxlength="11" placeholder="请输入手机号" value="${mobileNum}">
        </li>
      </ul>
      <div class="vtip errs" id="errorTip"></div>
    </div>
    <div class="operate-button operate-acc"> <a href="javascript:;" class="btn" onclick="return getMobileCode()">获取手机验证码</a></div>
  </div>
</div>
<jsp:include page="/include/wchat/footer.jsp"></jsp:include>
<script type="text/javascript">
   function getMobileCode(){
	   var $mobileNum = $('#mobileNum');
	   //检验手机号
	   if($mobileNum.val() == null || $mobileNum.val()==''){
		   $("#errorTip").html("请输入手机号").show();
		   return false;
	   }
	   var regMobile = /^(13[0-9]|15[0-9]|18[0-9])\d{8}$/;
	   if(!regMobile.test($mobileNum.val())){
		   $("#errorTip").html('手机号格式不正确，请检查').show();
		   return false;
	   }
	   $.ajax({
		   type: 'POST',
		   url: environment.basePath + "/getMoblieVerifyCode.do",
		   data: {"mobileNum": $mobileNum.val()},
		   success: function(data){
			   if(data.code < 0){
				   $("#errorTip").html(data.msg).show();
				   return false;
			   }
			   window.location.href = "/bindMobileNext.do?mobileNum=" + $mobileNum.val();
		   }
	   });
   }
</script>
</body>
</html>